/**
 * 系统主页的底部区域，主要放置用户单位信息，服务单位和服务人员信息
 */
Ext.define('app.main.region.Bottom', {

    extend: 'Ext.toolbar.Toolbar',

    alias: 'widget.mainbottom',

    uses: ['app.ux.ButtonTransparent'],

    defaults: {
        xtype: 'buttontransparent'
    },

    style: 'background-color : #f6f5ec;',

    items: [{
        icon: '/Content/images/user.png',
        bind: {
            text: '<a style="color:blue">' + _loginDeptName+'>>' + _loginUserName + '</a>'
        },
        handler: function () {
            var win = Ext.create("app.system.user.EditPass", { title: '编辑信息' });
            win.on("savesuccess", function ()
            {
                window.location.href = "/Account/Logout";
            })
            win.show();
        }
    }, {
        bind: {
            text: '{userInfo.department}'
        }
    },
    //{
    //      text: 'tt', 
    //    handler: function (button) {            
    //        window.location.href = "/prm/home/ProjectProgress";
    //    }
    //},
            '->',

            {
                bind: {
                    text: '{serviceInfo.company}'
                },
                glyph: 0xf059

            }, {
                bind: {
                    text: '{serviceInfo.name}'
                }
            },
            {
            	bind : {
            	    text: '{serviceInfo.phonenumber}'
            	},
            	glyph : 0xf095
            },
            {
                bind: {
                    hidden: '{!serviceInfo.email}', // 绑定值前面加！表示取反，如果有email则不隐藏，如果email未设置，则隐藏
                    text: '{serviceInfo.email}'
                },
                glyph: 0xf003,
                handler: function (button) {
                    // 发送邮件
                    var vm = button.up('app-main').getViewModel();
                    var link = "mailto:" + vm.get('serviceInfo.email')
                            + "?subject=" + vm.get('userInfo.company')
                            + vm.get('userInfo.name') + " 关于 "
                            + vm.get('systemInfo.name') + " 的咨询";
                    window.location.href = link;
                }
            }, {
                bind: {
                    text: '©{serviceInfo.copyright}'
                }
            }]
});